﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.Master" Inherits="System.Web.Mvc.ViewPage<VietThuongLMS.ViewModels.LopHocViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <legend>
        Danh Sách Lớp Học
    </legend>
    <%= Html.ActionLink("Thêm Mới Lớp Học", "Create", "LopHoc", new { area = "Admin" }, new { @class = "btn btn-success" }) %>
    <%= Html.ActionLink("Tìm Kiếm Lớp Học", "Search", "LopHoc", new { area = "Admin" }, new { @class = "btn btn-success" })%>
    <%--<%= Html.ActionLink("Tìm Kiếm Học Viên", "Search", "HocVien", new { area = "Admin", maLopHoc = @item.ID }, new { @class = "btn btn-success" })%>--%>
    <table class="table table-hover table-striped" >
        <thead>
        <tr>
            <th>
                #
            </th>
            <th>
                Tên Lớp Học
            </th>
            <th>
                Tên Chi Nhánh
            </th>
            <th>
                Ngày Khai Giảng
            </th>
            <%--<th>
                Ngày Kết Thúc
            </th>--%>
            <th>
                Tình Trạng
            </th>
            <th>
                Loại Lớp Học
            </th>
            <th>
                Hành động
            </th>
        </tr>
        </thead>
        <tbody>
    <% 
        if (@Model != null && @Model.List.Count > 0)
        {
            int i = 1;
            foreach (VietThuongLMS.LopHoc @item in @Model.List)
            { %>
    
        <tr>
            <td>
                <%=i%>
            </td>
            <td>
                <%= Html.ActionLink(@item.TenLopHoc , "Detail", "LopHoc", new { area = "Admin", @id = @item.ID }, null)%>
            </td>
            <td>
                <%=@item.ChiNhanhReference.Value.TenChiNhanh%>
            </td>
            <td>
                <%=@item.NgayKhaiGiang.Value.ToString("dd/MM/yyyy")%>
            </td>
           <%-- <td>
                <%=@item.NgayKetThuc.Value.ToShortDateString() %>
            </td>--%>
            <td>
                <%=@item.TinhTrang %>
            </td>
            <td>
                <%=@item.LoaiLopHoc.MoTa %>
            </td>
            <td>
                <%= Html.ActionLink("Edit", "Edit", "LopHoc", new { area = "Admin", id = @item.ID }, new { @class = "btn btn-primary" })%>
                <% if ((@item.TinhTrang == "Sắp Mở") || (@item.TinhTrang == "Đang Học")) 
                   { %>
                    <%= Html.ActionLink("Phân Công", "Index", "PhanCong", new { area = "Admin", maLopHoc = @item.ID }, new { @class = "btn btn-primary" })%>
                <% } %>
                <% if (@item.TinhTrang == "Đang Học")
                   { %>
                    <%= Html.ActionLink("Điểm Danh", "Index", "DiemDanh", new { area = "Admin", maLopHoc = @item.ID }, new { @class = "btn btn-primary" })%>
                <% } %>
                <a href="#myModal_<%=i %>" class="btn btn-danger" data-toggle="modal">Delete</a>
                <!-- Modal -->
                <div id="myModal_<%=i %>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                    aria-hidden="true">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            ×</button>
                        <h3 id="myModalLabel">
                            Delete</h3>
                    </div>
                    <div class="modal-body">
                        <p>
                            Are you sure you want to delete <b>"<%=@item.ID%>"</b> ?</p>
                    </div>
                    <div class="modal-footer">
                        <button class="btn" data-dismiss="modal" aria-hidden="true">
                            No</button>
                        <%= Html.ActionLink("Delete", "Delete", "LopHoc", new { area = "Admin", @id = @item.ID }, new { @class = "btn btn-primary" })%>
                    </div>
                </div>

            </td>
    
            <% i++;
                    }%>
            <tr>
                <td colspan="10">
                    <%
                        if ((string)ViewData["pageLinks"] != "")
                        { %>
                    <%= ViewData["pageLinks"] %>
                    <% } %>
                </td>
            </tr>
            <%
                }
                else
                {
            %>
            <tr>
                <td colspan="10" style="text-align: center;">
                    Empty List
                </td>
            </tr>
        </tr>
    </tbody>
    </table>   
    <% } %>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
